package com.atguigu4.search_sort.exer1;

/**
 * @author NoobMaster69  * @date 2024/5/27 0027 星期一 15:37
 */
public class ArrayExer_2 {
    public static void main(String[] args) {
//        int[] arr = {1,2,3,4,5,6,7};
//
//        int delete = 4;
//
//        for (int i = delete; i < arr.length - 1; i++) {
//            arr[i] = arr[i + 1];
//
//        }
//            arr[arr.length - 1] = 0;
//
//        for (int i = 0; i < arr.length; i++) {
//            System.out.print(arr[i]);
//        }
        int delete = 4;
        int[] arr = {1,2,3,4,5,6,7};
        int[] newArr = new int[arr.length -1];

        for (int i = 0; i < delete; i++) {
            newArr[i] = arr[i];
        }

        for (int i = delete; i < newArr.length; i++) {
            newArr[i] = arr[i + 1];
        }

        arr = newArr;

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
        }
    }
}
